package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysPurchaseplanMapper;
import com.ruoyi.system.domain.SysPurchaseplan;
import com.ruoyi.system.service.ISysPurchaseplanService;
import com.ruoyi.common.core.text.Convert;

/**
 * 采购计划Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-12-13
 */
@Service
public class SysPurchaseplanServiceImpl implements ISysPurchaseplanService 
{
    @Autowired
    private SysPurchaseplanMapper sysPurchaseplanMapper;

    /**
     * 查询采购计划
     * 
     * @param purchasePlanId 采购计划ID
     * @return 采购计划
     */
    @Override
    public SysPurchaseplan selectSysPurchaseplanById(Long purchasePlanId)
    {
        return sysPurchaseplanMapper.selectSysPurchaseplanById(purchasePlanId);
    }

    /**
     * 查询采购计划列表
     * 
     * @param sysPurchaseplan 采购计划
     * @return 采购计划
     */
    @Override
    public List<SysPurchaseplan> selectSysPurchaseplanList(SysPurchaseplan sysPurchaseplan)
    {
        return sysPurchaseplanMapper.selectSysPurchaseplanList(sysPurchaseplan);
    }

    /**
     * 新增采购计划
     * 
     * @param sysPurchaseplan 采购计划
     * @return 结果
     */
    @Override
    public int insertSysPurchaseplan(SysPurchaseplan sysPurchaseplan)
    {
        sysPurchaseplan.setCreateTime(DateUtils.getNowDate());
        return sysPurchaseplanMapper.insertSysPurchaseplan(sysPurchaseplan);
    }

    /**
     * 修改采购计划
     * 
     * @param sysPurchaseplan 采购计划
     * @return 结果
     */
    @Override
    public int updateSysPurchaseplan(SysPurchaseplan sysPurchaseplan)
    {
        return sysPurchaseplanMapper.updateSysPurchaseplan(sysPurchaseplan);
    }

    /**
     * 删除采购计划对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysPurchaseplanByIds(String ids)
    {
        return sysPurchaseplanMapper.deleteSysPurchaseplanByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除采购计划信息
     * 
     * @param purchasePlanId 采购计划ID
     * @return 结果
     */
    @Override
    public int deleteSysPurchaseplanById(Long purchasePlanId)
    {
        return sysPurchaseplanMapper.deleteSysPurchaseplanById(purchasePlanId);
    }
}
